package com.itheima06;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class MyThreadDemo3 {


    public static void main(String[] args) {
        ThreadPoolExecutor pool=new ThreadPoolExecutor(
                1,
                3,
                60,
                TimeUnit.SECONDS,
                new ArrayBlockingQueue<>(5),
                Executors.defaultThreadFactory(),
                new ThreadPoolExecutor.AbortPolicy()
        );

        pool.submit(()->{
            System.out.println(Thread.currentThread().getName()+"在执行了");
        });

      while (true){
          pool.submit(()->{
              System.out.println(Thread.currentThread().getName()+"在执行了");
          });
      }
//        pool.shutdown();

    }
}
